package com.si.sea_island.config;


import com.si.sea_island.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/api/**","/pay/**")
                .excludePathPatterns("/api/login"
                        ,"/api/loginOrRegisterPhone"
                        ,"/api/getShopList"
                        ,"/api/searchShop"
                        ,"/api/searchShopByIntegral"
                        ,"/api/getShop"
                        ,"/api/getCardList"
                        ,"/api/pay/alipayNotify"
                        ,"/api/forgotPassword"
                        ,"/api/automaticLogon"
                        ,"/api/getSMS"
                        ,"/api/test"
                        ,"/api/adminLogin");
    }
}